package edu.sdjzu.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

@RestController
@RefreshScope
public class NacosConfigController {
    @Value("${pattern.dateformat}")
    private String dateFormat;
    @GetMapping("/date")
    public String hello() {
        LocalDate today = LocalDate.now();
        DateTimeFormatter formater = DateTimeFormatter.ofPattern(dateFormat);
        return "今天的日期是：" + today.format(formater);
    }
}
